package com.gitee.wsl.lang.character

enum class CharCodes(val code: Int) {
    Tab(0x9), // "\t"
    NewLine(0xa), // "\n"
    FormFeed(0xc), // "\f"
    CarriageReturn(0xd), // "\r"
    Space(0x20), // " "
    ExclamationMark(0x21), // "!"
    Number(0x23), // "#"
    Amp(0x26), // "&"
    SingleQuote(0x27), // "'"
    DoubleQuote(0x22), // '"'
    Dash(0x2d), // "-"
    Slash(0x2f), // "/"
    Zero(0x30), // "0"
    Nine(0x39), // "9"
    Semi(0x3b), // ";"
    Lt(0x3c), // "<"
    Eq(0x3d), // "="
    Gt(0x3e), // ">"
    QuestionMark(0x3f), // "?"
    UpperA(0x41), // "A"
    LowerA(0x61), // "a"
    UpperF(0x46), // "F"
    LowerF(0x66), // "f"
    UpperZ(0x5a), // "Z"
    LowerZ(0x7a), // "z"
    LowerX(0x78), // "x"
    OpeningSquareBracket(0x5b), // "["
    Tilde('~'.code), // "~"
}

internal val charCodesArray:List<Int> by lazy { CharCodes.entries.map { it.code }  }

fun Char.isCharCode() = this.code in charCodesArray